﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>收款记录</title>
    <script src="/js/header.js"></script>
    <script src="/lib/date/wdatepicker.js"></script>
</head>
<body>
    <div class="data-wrap case">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
            </div>
            <div class="pull-right">
                <form class="form-inline" id="formSearch">
                    <div class="input-group input-group-sm">
                        <div class="input-sm"><input name="autoRefresh" type="checkbox" title="10秒自动刷新" /> <label id="time" class="wd100">10秒自动刷新</label></div>
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">订单号：</label>
                        <input class="form-control" name="orderNo" type="text" autocomplete="off">
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">收款姓名：</label>
                        <input class="form-control" name="cardName" type="text" autocomplete="off">
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">客户姓名：</label>
                        <input class="form-control" name="withdrawalAccountName" type="text" autocomplete="off">
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">通知状态：</label>
                        <select class="form-control" name="noticeStatus">
                            <option value="-1">请选择</option>
                            <option value="1">未通知</option>
                            <option value="2">通知成功</option>
                            <option value="3">通知失败</option>
                            <option value="4">通知中</option>
                        </select>
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">收款时间：</label>
                        <input id="d421" class="Wdate wd150" name="startTime" type="text" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" />
                        --<input id="d422" class="Wdate wd150 m5_l" name="endTime" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'d421\')}'})" />
                    </div>
                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>
        <div class="paging"></div>
    </div>

    <script type="text/x-dot-template" id="pgerTemplate">
        <div class="data-body data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th class="t_l wd175">订单号</th>
                                <th class="t_l wd100">公司名称</th>
                                <th class="t_l wd200">收款单号</th>
                                <th class="t_l wd100">收款银行</th>
                                <th class="t_l wd100">收款姓名</th>
                                <th class="t_l wd150">收款卡号</th>
                                <th class="t_r wd75">收款金额</th>
                                <th class="t_l wd150">收款时间</th>
                                <th class="t_l wd100">交易类型</th>
                                <th class="t_l wd125">通知状态</th>
                                <th class="t_l wd150">通知时间</th>
                                <th class="t_l wd75">通知次数</th>
                                <th class="t_l wd75">客户姓名</th>
                                <th class="t_l wd150">客户银行</th>
                                <th class="t_l wd150">客户卡号</th>
                                <th class="t_l wd200">客户附言</th>
                                <th class="t_l wd150">创建时间</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{? it.tData && it.tData.length>0}}
                            {{~it.tData :item:index}}
                            <tr>
                                <td class="t_l wd175">{{?  item.orderNo}}{{= item.orderNo }}{{??}}{{?}}</td>
                                <td class="t_l wd100" title="{{= item.companyName }}">{{= item.companyName }}</td>
                                <td class="t_l wd200" title="{{= item.withdrawalOrderNo }}">{{= item.withdrawalOrderNo }}</td>
                                <td class="t_l wd100">{{= item.bankName }}</td>
                                <td class="t_l wd100">{{= item.cardName }}</td>
                                <td class="t_l wd150">{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}</td>
                                <td class="t_r bold wd75">{{= item.withdrawalAmount }}</td>
                                <td class="t_l wd150">{{= FlashPay.Util.FormatDate(item.paymentDate) }}</td>
                                <td class="t_l wd100">{{= item.depositType }}</td>
                                <td class="t_l wd125">
                                    {{? item.noticeStatus==4 }}
                                    <span class="orange bold">通知中</span>
                                    {{?? item.noticeStatus==3 }}
                                    <span class="red bold">通知失败</span> {{? item.timeDifference>6 && item.noticeTimes==5 }}<a class="btn btn-warning btn-xs" data-confirm='"{{= item.orderNo }}" <br>确定要<span class="orange">重置</span>吗？' data-href="/Receipt/ResetNoticeStatus?orderNo={{= item.orderNo}}">重置</a>{{? }}
                                    {{?? item.noticeStatus==2 }}
                                    <span class="green bold">通知成功</span>
                                    {{?? item.noticeStatus==1 }}
                                    <span class="bold">未通知</span>
                                    {{?}}
                                </td>
                                <td class="t_l wd150">{{= FlashPay.Util.FormatDate(item.noticeLastDate) }}</td>
                                <td class="t_l wd75">{{= item.noticeTimes }}</td>
                                <td class="t_l wd75">{{= item.withdrawalAccountName }}</td>
                                <td class="t_l wd150" title="{{= FlashPay.Util.isNullOrEmptySpance(item.withdrawalBankName)?"":item.withdrawalBankName }}">{{= FlashPay.Util.isNullOrEmptySpance(item.withdrawalBankName)?"":item.withdrawalBankName }}</td>
                                <td class="t_l wd150">{{= FlashPay.Util.SubCardNumber(item.withdrawalCardNumber) }}</td>
                                <td class="t_l wd200">{{= FlashPay.Util.isNullOrEmptySpance(item.postScript)?"":item.postScript }}</td>
                                <td class="t_l wd150">{{= FlashPay.Util.FormatDate(item.createDbdate) }}</td>
                            </tr>
                            {{~}}
                            {{??}}
                            <tr class="noRecord">
                                <td colspan="17">暂无记录！</td>
                            </tr>
                            {{?}}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>
    <script type="text/javascript">
        var wait = 10;
        var autoRefresh = $("input[name='autoRefresh']");

        $(function () {
            setTime();
            FlashPay.UI.DataAutoHeight();

            FlashPay.UI.Triggerbox({
                btnAdvSearch: '#AdvSearch',
                searchCallBack: function () {
                },
                cancelCallBack: function () {

                }
            });

            $("#btnSearch").click(function () {
                FlashPay.UI.DoSearch();
            });

            doSearch();

            $(document).keyup(function (event) {
                var keycode = event.which;
                if (keycode == 13) {
                    FlashPay.UI.DoSearch();
                }
            });

            $(autoRefresh).change(function () {
                time();
            });
        });

        //倒时计
        function time() {
            var obj = document.getElementById("time");
            var isauto = $(autoRefresh).is(':checked');
            if (!isauto) {
                obj.innerText = "10秒自动刷新";
                return false;
            }

            if (wait == 0) {
                obj.innerText = "10秒自动刷新";
                wait = 10;
                if (isauto) {
                    setTimeout(function () { time(); }, 1000);
                }
                FlashPay.UI.DoSearch();
            } else {
                obj.innerText = wait + "秒自动刷新";
                wait--;
                setTimeout(function () { time(); }, 1000);
            }
        }

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function doSearch() {
            let startTime = $("input[name='startTime']").val();
            let endTime = $("input[name='endTime']").val();
            let start = new Date(startTime).getMonth();
            let end = new Date(endTime).getMonth();
            if ((end + 1) - (start + 1) > 6) {
                FlashPay.UI.Tip_warning("时间区间不能超过六个月");
                return;
            }
            FlashPay.UI.Pager(".paging", { templateId: "pgerTemplate", pageSize: 15, ajax: { url: '/Receipt/GetReceiptRecord' } });
        }

        function setTime() {
            let startTime = FlashPay.Util.GetDateStr(-1);
            $("input[name='startTime']").val(startTime);
            let endTime = FlashPay.Util.GetDateStr(0);
            $("input[name='endTime']").val(endTime);
        }
    </script>
</body>
</html>